<template>
	<view>
		<city-select
			@cityClick="cityClick"
			:formatName="formatName"
			:activeCity="activeCity"
			:hotCity="hotCity"
			:obtainCitys="obtainCitys"
			:isSearch="true"
			ref="citys"
		></city-select>
	</view>
</template>

<script>
import citys from './citys.js'
console.log(citys.length)
import citySelect from '@/components/city-select/city-select.vue'
export default {
	data() {
		return {
			//需要构建索引参数的名称（注意：传递的对象里面必须要有这个名称的参数）
			formatName: 'title',
			//当前城市
			activeCity: {
				id: 1,
				title: '南京市'
			},
			//热门城市
			hotCity: [
				{
					id: 0,
					title: '南京市'
				},
				{
					id: 1,
					title: '南京市'
				}
			],
			//显示的城市数据
			obtainCitys: [
				{
					id: 0,
					title: '南京'
				},
				{
					id: 1,
					title: '北京'
				},
				{
					id: 2,
					title: '天津'
				},
				{
					id: 3,
					title: '东京'
				}
			]
		}
	},
	components: {
		citySelect
	},
	
	onLoad(city) {
		//动态更新数据
					this.formatName = 'cityName'
					//修改当前城市
					console.log(city)
					this.activeCity = {
						cityName: city.citys,
						cityCode: 110100
					}
					//修改热门城市
					this.hotCity = [
						{
							id: 0,
							cityName: '北京市'
						},
						{
							id: 1,
							cityName: '上海市'
						},
						{
							id: 2,
							cityName: '南京市'
						},
						{
							id: 3,
							cityName: '天津市'
						},
						{
							id: 4,
							cityName: '石家庄市'
						}
					]
					//修改构建索引数据
					this.obtainCitys = citys
					
					
	},
	methods: {
		cityClick(item) {
			const city=JSON.parse(JSON.stringify(item.cityName))
			console.log(city);
			uni.reLaunch({
				url:`/pages/FilmModule/index?citys=${city}`
			})
		}
	}
}
    
</script>

<style scoped>
	.city-select .hot-city[data-v-737f9817] {
	    padding-left: 1.4375rem;
	    padding-right: 1.25rem;
	    overflow: hidden;
	    width: 105vw !important;
		background-color: blue;
	}
</style>
